clc
clear all
%% Open airfoil data
fid = fopen('2032c.dat','r');
line = 0;
i = 2;
j = 2;
while ~feof(fid)
    tline = fgetl(fid);
    line = line + 1;
    newline{line,1} = tline;
    if line > 1
        x(line-1) = str2double(tline(1:8));
        y(line-1) = str2double(tline(10:17));
        x_up(1) = x(1);
        y_up(1) = y(1);
        if line > 2 && x(line-1) < x(line-2)
            x_up(i) = x(line-1);
            y_up(i) = y(line-1);
            i = i + 1;
        elseif line > 2 && x(line-1) > x(line-2)
            x_low(j) = x(line-1);
            y_low(j) = y(line-1);
            j = j + 1;
        else
            x_up(1) = x(1);
            y_up(1) = y(1);
        end
    end
    
    
end
fclose(fid);